<?php

/**
 * Nette Framework - Profiler screen template.
 *
 * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
 *
 * This source file is subject to the "Nette license" that is bundled
 * with this package in the file license.txt.
 *
 * For more information please see http://nettephp.com
 *
 * @author     David Grudl
 * @copyright  Copyright (c) 2004, 2009 David Grudl
 * @license    http://nettephp.com/license  Nette license
 * @link       http://nettephp.com
 * @category   Nette
 * @package    Nette
 * @version    $Id: profiler.phtml 259 2009-04-06 11:44:19Z david@grudl.com $
 *
 * @param      array     $colophons
 * @return     void
 */

/*namespace Nette;*/

?>

<style type="text/css">
/* <![CDATA[ */
	#netteProfilerContainer {
		position: fixed;
		_position: absolute;
		right: 5px;
		bottom: 5px;
		z-index: 23178;
	}

	#netteProfiler {
		font: normal normal 11px/1.4 Consolas, Arial;
		position: relative;
		padding: 1px;
		color: black;
		background: #EEE;
		border: 1px dotted gray;
		cursor: move;
		opacity: .70;
		=filter: alpha(opacity=70);
	}

	#netteProfiler * {
		color: inherit;
		background: inherit;
		text-align: inherit;
	}

	#netteProfilerIcon {
		position: absolute;
		right: 0;
		top: 0;
		line-height: 1;
		padding: 4px;
		color: black;
		text-decoration: none;
	}

	#netteProfiler:hover {
		opacity: 1;
		=filter: none;
	}

	#netteProfiler ul {
		margin: 0;
		padding: 0;
		width: 350px;
	}

	#netteProfiler li {
		margin: 0;
		padding: 1px;
		text-align: left;
		list-style: none;
	}

	#netteProfiler span[title] {
		border-bottom: 1px dotted gray;
		cursor: help;
	}

	#netteProfiler strong {
		color: red;
	}
/* ]]> */
</style>


<div id="netteProfilerContainer">
<div id="netteProfiler">
	<a id="netteProfilerIcon" href="#"><span>&#x25bc;</span></a
	><ul>
	<?php foreach ($colophons as $callback): ?>
	<?php foreach ((array) call_user_func($callback, 'profiler') as $line): ?><li><?php echo $line, "\n" ?></li><?php endforeach ?>
	<?php endforeach ?>
	</ul>
</div>
</div>


<script type="text/javascript">
/* <![CDATA[ */
document.getElementById('netteProfiler').onmousedown = function(e) {
	e = e || event;
	this.posX = parseInt(this.style.left + '0');
	this.posY = parseInt(this.style.top + '0');
	this.mouseX = e.clientX;
	this.mouseY = e.clientY;

	var thisObj = this;

	document.documentElement.onmousemove = function(e) {
		e = e || event;
		thisObj.style.left = (e.clientX - thisObj.mouseX + thisObj.posX) + "px";
		thisObj.style.top = (e.clientY - thisObj.mouseY + thisObj.posY) + "px";
		return false;
	};

	document.documentElement.onmouseup = function(e) {
		document.documentElement.onmousemove = null;
		document.documentElement.onmouseup = null;
		return false;
	};
};

document.getElementById('netteProfilerIcon').onclick = function(e) {
	var span = this.getElementsByTagName('span')[0];
	var panel = this.nextSibling;
	var collapsed = panel.currentStyle ? panel.currentStyle.display == 'none' : getComputedStyle(panel, null).display == 'none';

	span.innerHTML = collapsed ? String.fromCharCode(0x25bc) : 'Profiler ' + String.fromCharCode(0x25ba);
	panel.style.display = collapsed ? 'block' : 'none';
	span.parentNode.style.position = collapsed ? 'absolute' : 'static';
	return false;
}
/* ]]> */
</script>
